/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: 获取动态库中hdds_base接口函数的适配接口私有头文件.
 * Author: qingjicheng
 * Create: 2022-11-28
 */

#ifndef DLHDDS_FUNCTION_H
#define DLHDDS_FUNCTION_H

#include <functional>
#include <mutex>
#include <hccl/hccl_types.h>

#include "base.h"

namespace hccl {
class DlHddsFunction {
public:
    static DlHddsFunction &GetInstance();
    HcclResult DlHddsFunctionInit();
    virtual ~DlHddsFunction();
    std::function<s32(u64 key, u32 *psId)> dlQueryPartitionMapPsId = nullptr;
    std::function<s32(u32 partitionNum, u32 psNum, const u32 psId[])> dlInitPartitionMap = nullptr;
    std::function<s32(u64 *, u32 **, u32)> dlGetBatchPsIds = nullptr;

private:
    HcclResult DlHddsFunctionApiInit();
    DlHddsFunction(const DlHddsFunction&);
    DlHddsFunction &operator=(const DlHddsFunction&);
    DlHddsFunction();
    void *handle_ = nullptr;
    std::mutex handleMutex_;
};
}
#endif // DLHDDS_FUNCTION_H